<html>
<script type="text/javascript" src="options.js"></script>
<script type="text/javascript" src="context-menu.js"></script>
<script type="text/javascript">
chrome.extension.onRequest.addListener(
    function(request, sender, sendResponse) {
        chrome.pageAction.show(sender.tab.id);
        if (request.command == "options") {
            sendResponse({userList: getUserList(), 
                          wordList: getWordList(), 
                          delaySecs: getDelaySecs(), 
                          userReplaceEnabled: getUserReplaceEnabled(), 
                          wordReplaceEnabled: getWordReplaceEnabled(), 
                          smileys: getSmileys(), 
                          smileysEnabled: getSmileysEnabled(), 
                          hideIgnoredEnabled: getHideIgnoredEnabled(), 
                          eggsEnabled: getEggsEnabled()});
        }
        else if(request.command == "egg") {
            console.log('got egg command!');
            chrome.pageAction.setIcon({
                tabId: sender.tab.id,
                path: 'icon_monkey-16.png'
            });
        }
        else {
            sendResponse({}); // snub them.
        }
  });
</script>
</html>
